package com.inspinia.upms.common.model;

import com.inspinia.base.common.model.NameCodeEnum;

/**
 * Created by veblen on 2016/3/3.
 */
public enum Gender implements NameCodeEnum {
    man(1,"男"),
    woman(2,"女");

    private final int code;
    private final String name;

    Gender(int code, String name){
        this.code=code;
        this.name=name;
    }

    @Override
    public int getCode(){
        return code;
    }

    @Override
    public String getName(){
        return name;
    }


    public static Gender valueOf(int code){
        for(Gender gender:Gender.values()){
            if(gender.code==code){
                return gender;
            }
        }
        return null;
    }
}
